package com.wtwd.device.dao;


import com.wtwd.device.model.entity.Device;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author ljiong
 * @date 2021/08/11
 * @description
 */
@Mapper
public interface AppDeviceMapper {
    Device getDeviceByMacAddress(@Param("macAddress") String macAddress);

    Integer updateDeviceInfo(Device device);

    List<Device> getUserDeviceList(@Param("start") Integer start, @Param("pageSize") Integer pageSize, @Param("userId") Long userId);

    Integer unbindDevice(@Param("userId") Long userId, @Param("macAddress") String macAddress);

    Integer activeDevice(@Param("macAddress") String macAddress, @Param("watchId") String watchId,@Param("activeTime") Long activeTime, @Param("activation") Integer activation
            , @Param("lng") String lng, @Param("lat") String lat, @Param("area") String area);

    boolean clearSportDataByDate(String date);

    Device getDeviceByAppUserId(@Param("userId") Long userId);

    Integer updateDeviceCurrentFirmware(@Param("macAddress") String macAddress, @Param("currentFirmware") String currentFirmware);


    Integer updateDeviceCurrentFirmwareAndPreviousVersion(@Param("macAddress") String macAddress, @Param("currentFirmware") String currentFirmware, @Param("previousVersion") String previousVersion);

    Device getDeviceByImei(@Param("imei") String imei);
}
